<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="智红的博客">
    <meta name="keyword"  content="智红">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>
        
        ubuntu16.04搭建JAVA开发环境 - 智红的博客
        
    </title>

    <!-- Custom CSS -->
    
<link rel="stylesheet" href="/css/aircloud.css">

    
<link rel="stylesheet" href="/css/gitment.css">

    <!--<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">-->
    <link href="//at.alicdn.com/t/font_620856_pl6z7sid89qkt9.css" rel="stylesheet" type="text/css">
    <!-- ga & ba script hoook -->
    <script></script>
<meta name="generator" content="Hexo 5.3.0"></head>

<body>

<div class="site-nav-toggle" id="site-nav-toggle">
    <button>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
    </button>
</div>

<div class="index-about">
    <i> 好记性不如烂键盘呐 </i>
</div>

<div class="index-container">
    
    <div class="index-left">
        
<div class="nav" id="nav">
    <div class="avatar-name">
        <div class="avatar ">
            <img src="/img/avatar.jpg" />
        </div>
        <div class="name">
            <i>Zhihong Li</i>
        </div>
    </div>
    <div class="contents" id="nav-content">
        <ul>
            <li >
                <a href="/">
                    <i class="iconfont icon-shouye1"></i>
                    <span>主页</span>
                </a>
            </li>
            <li >
                <a href="/tags">
                    <i class="iconfont icon-biaoqian1"></i>
                    <span>标签</span>
                </a>
            </li>
            <li >
                <a href="/archive">
                    <i class="iconfont icon-guidang2"></i>
                    <span>存档</span>
                </a>
            </li>
            <li >
                <a href="/about/">
                    <i class="iconfont icon-guanyu2"></i>
                    <span>关于</span>
                </a>
            </li>
            
            <li>
                <a id="search">
                    <i class="iconfont icon-sousuo1"></i>
                    <span>搜索</span>
                </a>
            </li>
            
        </ul>
    </div>
    
        <div id="toc" class="toc-article">
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85openjdk8"><span class="toc-text">安装openjdk8</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85idea"><span class="toc-text">安装idea</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%BF%80%E6%B4%BBidea"><span class="toc-text">激活idea</span></a></li></ol>
</div>
    
</div>


<div class="search-field" id="search-field">
    <div class="search-container">
        <div class="search-input">
            <span id="esc-search"> <i class="icon-fanhui iconfont"></i></span>
            <input id="search-input"/>
            <span id="begin-search">搜索</span>
        </div>
        <div class="search-result-container" id="search-result-container">

        </div>
    </div>
</div>

        <div class="index-about-mobile">
            <i> 好记性不如烂键盘呐 </i>
        </div>
    </div>
    
    <div class="index-middle">
        <!-- Main Content -->
        


<div class="post-container">
    <div class="post-title">
        ubuntu16.04搭建JAVA开发环境
    </div>

    <div class="post-meta">
        <span class="attr">发布于：<span>2020-07-31 09:21:54</span></span>
        
        <span class="attr">标签：/
        
        <a class="tag" href="/tags/#ubuntu" title="ubuntu">ubuntu</a>
        <span>/</span>
        
        <a class="tag" href="/tags/#java" title="java">java</a>
        <span>/</span>
        
        
        </span>
        <span class="attr">访问：<span id="busuanzi_value_page_pv"></span>
</span>
</span>
    </div>
    <div class="post-content no-indent">
        <h1 id="安装openjdk8"><a href="#安装openjdk8" class="headerlink" title="安装openjdk8"></a>安装openjdk8</h1><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt update</span><br><span class="line">sudo apt install openjdk-8-jdk openjdk-8-jre</span><br></pre></td></tr></table></figure>
<p>用<code>java -version</code>确认安装成功</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">openjdk version &quot;1.8.0_252&quot;</span><br><span class="line">OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)</span><br><span class="line">OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)</span><br></pre></td></tr></table></figure>
<p>配置 JAVA_HOME 和 JRE_HOME 环境变量</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">cat &gt;&gt; /etc/environment &lt;&lt;EOL</span><br><span class="line">JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64</span><br><span class="line">JRE_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre</span><br><span class="line">EOL</span><br></pre></td></tr></table></figure>
<p>注销或重启系统，用<code>javac -version</code>确认<code>javac 1.8.0_252</code>环境配置成功</p>
<h1 id="安装idea"><a href="#安装idea" class="headerlink" title="安装idea"></a>安装idea</h1><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">sudo cp ~/下载/ideaIU-2020.1.tar.gz /usr/local/src</span><br><span class="line">cd /usr/local/src</span><br><span class="line">sudo tar -zxvf ideaIU-2020.1.tar.gz</span><br><span class="line">sudo cp ~/下载/jetbrains-agent.jar /usr/local/src/idea-IU-201.6668.121</span><br><span class="line">cd /usr/local/src/idea-IU-201.6668.121/bin</span><br><span class="line">sudo ./idea.sh</span><br></pre></td></tr></table></figure>
<p><code>Do not import settings</code> - <code>OK</code></p>
<p><code>Accept</code></p>
<p><code>Evaluate for free</code> - <code>Evaluate</code></p>
<p><code>选择UI主题</code> - <code>Next</code></p>
<p><code>Create a destop entry for ...</code> - <code>For all users...</code> - <code>Next</code></p>
<p><code>Create a script for opening ...</code> - <code>Next</code></p>
<p><code>Default plugins</code>不选 - <code>Next</code></p>
<p><code>Featured plugins</code>不选 - <code>Next</code></p>
<p>如果上面的没出现，可以点<code>Welcome</code>窗口右下角<code>Configure</code> - <code>Restore Default Settings</code></p>
<h1 id="激活idea"><a href="#激活idea" class="headerlink" title="激活idea"></a>激活idea</h1><p>启动idea，<code>Help</code> - <code>Edit Custom VM Options...</code></p>
<p>追加一行<code>-javaagent:/usr/local/src/idea-IU-201.6668.121/jetbrains-agent.jar</code></p>
<p><code>cat ~/下载/ACTIVATION_CODE.txt</code>，拷贝该激活码</p>
<p>重启idea，<code>Help</code> - <code>Register...</code> - <code>activation code</code> - <code>粘贴激活码</code> - <code>Activation</code></p>
<p>如果不行，尝试修改<code>/usr/local/src/idea-IU-201.6668.121/</code>整个目录的权限为<code>755</code></p>

        
        <br />
        <div id="comment-container">
        </div>
        <div id="disqus_thread"></div>

        <div id="lv-container">
        </div>

    </div>
</div>

    </div>
</div>


<footer class="footer">
    <ul class="list-inline text-center">
        
        

        

        

        

        

    </ul>
    
    <p>
        <span id="busuanzi_container_site_pv">
            <span id="busuanzi_value_site_pv"></span>PV
        </span>
        <span id="busuanzi_container_site_uv">
            <span id="busuanzi_value_site_uv"></span>UV
        </span>
        Created By <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a>  Theme <a target="_blank" rel="noopener" href="https://github.com/aircloud/hexo-theme-aircloud">AirCloud</a></p>
</footer>




</body>

<script>
    // We expose some of the variables needed by the front end
    window.hexo_search_path = "search.json"
    window.hexo_root = "/"
    window.isPost = true
</script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

<script src="/js/index.js"></script>

<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




</html>
